home *** CD-ROM | disk | FTP | other *** search
- Path: newsfeed.internetmci.com!xmission!inteleNET!usenet
- From: langj@jcave.com (Jonathan Lang)
- Newsgroups: comp.lang.c++,comp.sys.sgi.misc
- Subject: Re: What is the best way to initialize static template members?
- Date: Fri, 08 Mar 1996 02:07:54 GMT
- Organization: inteleNET Internet Services
- Message-ID: <4ho162$io5@vodka.intele.net>
- References: <313799EF.41C6@mozart.nmrcore.uab.edu> <313AAA8D.41C6@rus.uni-stuttgart.de>
- NNTP-Posting-Host: p133.jcave.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- Andreas Wierse <wierse@rus.uni-stuttgart.de> wrote:
-
- >Hunter Moseley wrote:
- >>
- >> What is the best way to initialize static template members?
- >>
- >> Example:
- >>
- >> template<class T>
- >> class X
- >> {
- >> private :
- >> static int min_buff_size;
- >> ...
- >> };
- >>
- >> What is the best way to initialize min_buff_size for a given
- >> X<T> class?
-
- >I don't know what's the best way, but I know what works for me :-).
-
- >I maintain a library and all static member initialization takes place
- >in a file named ec_statics.C. One line for example looks like the
- >following:
-
- >List<MMapEntry> *Malloc_tmp::mmaplist = new List<MMapEntry>;
-
- >Applied to your case this would look like:
-
- >X<T> X::min_buff_size = 100;
-
- >Note, that in my case even the static variable that is initialized
- >depends on the template.
-
- >I use C++ 4.0 under IRIX 5.3 on my Indigo.
-
- >You can read more about this in the ARM, section 9.4, pp. 179-181.
-
- First, wouldn't this be:
-
- int X<T>::min_buff_size = 100;
-
- ?
-
- Second, what is ARM?
- -- Jonathan Lang (langj@jcave.com)
-
-